package cn.com.smartdevices.bracelet.chart.base;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.RectF;

import java.util.ArrayList;
import java.util.List;

import cn.com.smartdevices.bracelet.chart.data.ChartDataLoader;
import cn.com.smartdevices.bracelet.chart.util.C0804t;

/* renamed from: cn.com.smartdevices.bracelet.chart.base.g */
public abstract class BaseChart<T extends Item> implements Chart, Item {
    protected RectF mRect; // f3785j;
    protected float mPaddingLeft; //f3786k;
    protected float mPaddingTop; //f3787l;
    protected float mPaddingRight; //f3788m;
    protected float mPaddingBottom;//f3789n;
    protected Renderer mRenderer; //f3790o;
    protected float mDensity; //f3791p;
    protected float mDensityScale; //f3792q;
    protected float mScroll; //f3793r;
    protected List<T> mItems; //f3794s;
    protected Context mContext; //f3795t;
    protected ChartDataLoader.LoadCallback mLoadCallback; //f3796u;
    protected BaseChart<? extends T> mParent; //f3797v;
    protected BaseChartView<? extends BaseChart<T>> f3798w;

    public BaseChart(Context context) {
        this.mDensity = C0804t.m8824a(context);
        this.mDensityScale = C0804t.m8837b(context);
        this.mContext = context;
        this.mItems = new ArrayList();
    }

    protected void doScroll (float f) { // m8278a
    }

    public void setPadding (float f, float f2, float f3, float f4) { // m8279a
        this.mPaddingLeft = f;
        this.mPaddingTop = f2;
        this.mPaddingRight = f3;
        this.mPaddingBottom = f4;
        notifyChanged();
    }

    public void draw(Canvas canvas) {
        draw(canvas, 1.0f);
    }

    public void draw(Canvas canvas, float f) {
        draw(canvas, this.mRect, f);
    }

    protected void draw(Canvas canvas, float f, boolean z) {
        draw(canvas, this.mRect, f, z);
    }

    protected abstract void draw(Canvas canvas, RectF rectF, float f);

    protected void draw(Canvas canvas, RectF rectF, float f, boolean z) {
        draw(canvas, rectF, f);
    }

    public void setRect(Rect rect) { // m8285a
        this.mRect = new RectF(rect);
        onRectChanged(this.mRect);
        notifyChanged();
    }

    protected void onRectChanged(RectF rectF) {  // m8286a
    }

    public void setLoadCallback(ChartDataLoader.LoadCallback c0731f) { // m8287a
        this.mLoadCallback = c0731f;
    }

    public void setParentView(BaseChartView<? extends BaseChart<T>> baseChartView) { // m8288a
        this.f3798w = baseChartView;
    }

    public void setParent(BaseChart<? extends T> c0718g) { //m8289a
        this.mParent = c0718g;
    }

    public void addItem (T t) { // m8290a
        synchronized (this.mItems) {
            this.mItems.add(t);
            onItemsChanged(this.mItems);
        }
    }

    public void setRenderer(Renderer c0754r) { // m8291a
        this.mRenderer = c0754r;
    }

    protected void onItemsChanged(List<T> list) { // a_
    }

    public void setRect(RectF rectF) { // m8292b
        this.mRect = rectF;
        onRectChanged(this.mRect);
        notifyChanged();
    }

    public void scroll(float f) { // m8293d
        this.mScroll += f;
        doScroll(f);
        notifyChanged();
    }

    public void notifyChanged () { // m8294e
    }

    public void scrollTo (float f) { //m8295e
        float f2 = f - this.mScroll;
        this.mScroll = f;
        doScroll(f2);
        notifyChanged();
    }

    public void fillItems(List<? extends T> list) { // m8296f
        synchronized (this.mItems) {
            this.mItems.clear();
            this.mItems.addAll(list);
            onItemsChanged(this.mItems);
        }
    }

    public void addItems(List<? extends T> list) {  // m8297g
        synchronized (this.mItems) {
            this.mItems.addAll(list);
            onItemsChanged(this.mItems);
        }
    }

    public void m8298k() {
    }

    public Context getContext() { // m8299l
        return this.mContext;
    }

    public RectF getRect() { // m8300m
        return this.mRect;
    }

    public float getPaddingLeft () { //m8301n
        return this.mPaddingLeft;
    }

    public float getPaddingTop () {// m8302o
        return this.mPaddingTop;
    }

    public float getPaddingRight() {// m8303p
        return this.mPaddingRight;
    }

    public float getPaddingBottom() { // m8304q
        return this.mPaddingBottom;
    }

    public Renderer getRenderer () { // m8305r
        return this.mRenderer;
    }

    public float getScroll () { // m8306s
        return this.mScroll;
    }

    public void clearItems() { // m8307t
        synchronized (this.mItems) {
            this.mItems.clear();
            onItemsChanged(this.mItems);
        }
    }

    public List<T> getItems() {  // m8308u
        return this.mItems;
    }

    public BaseChart<? extends T> getParent() { // m8309v
        return this.mParent;
    }

    public BaseChartView<? extends BaseChart<T>> getParentView() { // m8310w
        return this.f3798w;
    }
}
